apiVersion: apps/v1
kind: Deployment
metadata:
  name: ${deployName}
  namespace: ${namespace}
  labels:
    service: ${moduleName}
    version: ${version}
spec:
  replicas: ${replicasNum}
  minReadySeconds: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      service: ${moduleName}
      version: ${version}
  template:
    metadata:
      labels:
        service: ${moduleName}
        version: ${version}
        sidecar.istio.io/inject: "true"
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                - key: app
                  operator: In
                  values:
                    - app
                    - node
                    - ${moduleName}
                    - ${productCode}
      containers:
      - name: "app"
        image: ${imageName}
        imagePullPolicy: Always
        resources:
          requests:
            memory: ${minMem}Mi
            ephemeral-storage: ${diskSize}Gi
          limits:
            memory: ${maxMem}Mi
            ephemeral-storage: ${diskSize}Gi
        volumeMounts:
          - name: sfere-time-zone
            mountPath: /etc/localtime
            readOnly: true
        env:
        - name: TZ
          value: Asia/Shanghai
      volumes:
        - name: sfere-time-zone
          hostPath:
            path: /etc/localtime